/** 
 * ObjectsTreeSensor - displays the objects in a tree view in the sensor mode
 *
 * @author jprieur
 * @created April 12th 2007
 *
 */
package mygui;

import kernel.*;
import objects.*;

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import java.util.*;

public class ObjectsTreeSensor extends ObjectsTree
{

    public ObjectsTreeSensor(MonIHM gui)
    {
	super(gui);
    }

    protected void createNodes(DefaultMutableTreeNode top) {
	top.removeAllChildren();
	
	DefaultMutableTreeNode category;
	DefaultMutableTreeNode item;

	Simulator _kernel = Simulator.getSimulator();
	SensorSimulator kernel = (SensorSimulator)_kernel;
	Vector<SensorNetwork> networks = kernel.getSensorNetworkVector();
	Vector<Sink> sinks = kernel.getSinkVector();
	Vector<Obstacle> obstacles = kernel.getObstacle();
		
	category = new DefaultMutableTreeNode(SENSOR);
	for(SensorNetwork network: networks){
	    item = new DefaultMutableTreeNode(network);
	    category.add(item);
	}
	top.add(category);

	category = new DefaultMutableTreeNode(SINK);
	for(Sink sink: sinks){
	    item = new DefaultMutableTreeNode(sink);
	    category.add(item);
	}
	top.add(category);

	category = new DefaultMutableTreeNode(OBSTACLE);
	for(Obstacle obstacle: obstacles){
	    item = new DefaultMutableTreeNode(obstacle);
	    category.add(item);
	}
	top.add(category);
    }
}